package com.xls.box2023.home;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.xls.box2023.R;

public class XiaoHaoJiFenYouXiDialog extends Dialog implements View.OnClickListener {
    private TextView dialog_tv_hint;
    private TextView dialog_tv_download;
    private TextView dialog_tv_cancle;
    private View.OnClickListener onClickListener;
    private float downCoins;

    public XiaoHaoJiFenYouXiDialog(@NonNull Context context,float downCoins, View.OnClickListener onClickListener) {
        super(context);
        this.onClickListener=onClickListener;
        this.downCoins=downCoins;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setContentView(R.layout.dialog_xiaohaojifen_youxi);
        initView();
    }

    private void initView() {
        dialog_tv_hint = findViewById(R.id.dialog_tv_hint);
            dialog_tv_hint.setText("下载游戏需要消耗"+downCoins+"金币");
        dialog_tv_download = findViewById(R.id.dialog_tv_download);
        dialog_tv_cancle = findViewById(R.id.dialog_tv_cancle);
        dialog_tv_download.setOnClickListener(this);
        dialog_tv_cancle.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (onClickListener!=null)onClickListener.onClick(view);
        dismiss();
    }
}
